<template>
  <div class="admin_nav">
    <div>后台管理</div>
    <div>当前管理站点 : {{ this.$store.state.area.collegeName }}</div>
    <div>
      <el-dropdown>
        <span class="el-dropdown-link">
          {{ this.$store.state.user.nickname }}
          <el-icon class="el-icon--right">
            <arrow-down />
          </el-icon>
        </span>
        <template #dropdown>
          <el-dropdown-menu>
            <el-dropdown-item @click="navClose">退出</el-dropdown-item>
            <el-dropdown-item @click="openIndex">首页</el-dropdown-item>
          </el-dropdown-menu>
        </template>
      </el-dropdown>
    </div>
  </div>
</template>

<script>
export default {
  name: "AdminNavComponent",
  data(){
    return{
      user:this.$store.state.user,
    }
  },
  created(){
    this.$store.dispatch("updateUser").then(() => {
      this.user = this.$store.state.user;
      // this.isLogin=this.$store.state.user.isLogin==undefined
    });
  },
  methods:{
    navClose(){
      window.close()
    },
    openIndex(){
      window.open(document.location.origin + '/index.html')
    }
  }
};
</script>

<style scoped>
.admin_nav {
  display: flex;
  justify-content: space-between;
  padding: 20px;
  background-color: rgb(67, 74, 80);
  color: white;
}
.el-dropdown-link{
    color: white;
}
</style>